package com.example.aircraftwar.codes.prop;

import static com.example.aircraftwar.codes.aircraft.HeroAircraft.getHeroAircraft;

import android.content.Context;

import com.example.aircraftwar.codes.strategy.HeroDispersiveShoot;
import com.example.aircraftwar.codes.strategy.HeroStraightShoot;

public class BulletProp extends  AbstractProp {

    public BulletProp(Context context, int locationX, int locationY, int speedX, int speedY) {
        super(context, locationX, locationY, speedX, speedY);
    }

    @Override
    public void propAct(){
        Runnable bulletPropAct = () -> {
        try {
            for (int i = 0; i < 8; i++){
                getHeroAircraft(context).setStrategy(new HeroDispersiveShoot());
                Thread.sleep(1000);
            }
            getHeroAircraft(context).setStrategy(new HeroStraightShoot());
        }
        catch (InterruptedException e) {
            e.printStackTrace();
        }
    };
        new Thread(bulletPropAct, "火力道具生效线程").start();
    }
}
